<template>
	<view class="wallet_page">
		<nav-bar title="钱包"></nav-bar>
        <!-- 公共组件-每个页面必须引入 -->
        <public-module></public-module>
		<view class="money_icon">
			<image src="../../../static/icon/ic_goldcoin.png" mode="aspectFit"></image>
		</view>
		<view class="balance_num">
			<view>
				<text>余额</text>
				<view>￥{{balanceInfo.balance || 0}}</view>
			</view>
			<view class="line">
				<text>可提现</text>
				<view>￥{{balanceInfo.freeMoney || 0}}</view>
			</view>
		</view>
		<button class="drawing" @click="onPageJump('/pagesMy/my/wallet/drawing')">提现</button>
		<!-- <button class="drawing" @click="onPageJump('/pagesMy/my/wallet/authentication')">点击验证身份后才能提现</button> -->
		<view class="bill_title">明细</view>
		<view class="nav_bill_item" @click="onPageJump('/pagesMy/my/wallet/incomeBill')">
			<view class="info">
				<image src="../../../static/icon/ic_wallet_order.png" mode="aspectFit"></image>
				<text>交易明细</text>
			</view>
			<view class="arrow"></view>
		</view>
		<view class="nav_bill_item" @click="onPageJump('/pagesMy/my/wallet/profitBill')">
			<view class="info">
				<image src="../../../static/icon/ic_wallet_finance.png" mode="aspectFit"></image>
				<text>提现明细</text>
			</view>
			<view class="arrow"></view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			balanceInfo:{
				balance: 0,
				freeMoney: 0
			}
		};
	},
	//第一次加载
	onLoad(e) {
		this.pageData();
	},
	//页面显示
	onShow() {
		this.pageData();
	},
	//方法
	methods: {
		pageData() {
			this.$http
				.get('api/mime/wallet/v1/info')
				.then(res => {
					this.balanceInfo = res;
				});
		},
		onPageJump(url) {
			uni.navigateTo({
				url: url
			});
		}
	},
	//页面隐藏
	onHide() {},
	//页面卸载
	onUnload() {},
	//页面下来刷新
	onPullDownRefresh() {},
	//页面上拉触底
	onReachBottom() {},
	//用户点击分享
	onShareAppMessage(e) {
		return this.wxShare();
	}
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.wallet_page {
	padding: 0 30rpx 30rpx 30rpx;
	min-height: 100vh;
	background-color: #FFF;
}
.money_icon {
	padding-top: 40rpx;
	display: flex;
	justify-content: center;
	image{
		width: 288rpx;
		height: 300rpx;
		
	}
}
.balance_num {
	margin-top: 40rpx;
	display: flex;
	> view {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
		&.line::before {
			content: "";
			width: 2rpx;
			height: 60rpx;
			background-color: #e5e5e5;
			position: absolute;
			left: 0;
			top: 50%;
			transform: translateY(-50%);
		}
		text {
			font-size: 28rpx;
			color: #999999;
		}
		view {
			font-size: 32rpx;
			color: #555555;
			margin-top: 15rpx;
		}
	}
}
.drawing {
	margin-top: 60rpx;
	height: 88rpx;
	background-color: $themeColor;
	border-radius: 8rpx;
	font-size: 32rpx;
	color: #ffffff;
	line-height: 88rpx;
}
.bill_title {
	margin-top: 60rpx;
	margin-bottom: 60rpx;
	font-size: 28rpx;
	color: #cccccc;
	display: flex;
	align-items: center;
	&:before {
		content: "";
		flex: 1;
		margin-right: 45rpx;
		height: 2rpx;
		background-color: #e5e5e5;
	}
	&:after {
		content: "";
		flex: 1;
		margin-left: 45rpx;
		height: 2rpx;
		background-color: #e5e5e5;
	}
}
.nav_bill_item {
	background-color: #f7f7f7;
	border-radius: 8rpx;
	padding: 30rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20rpx;
	.info {
		display: flex;
		align-items: center;
		image {
			width: 40rpx;
			height: 40rpx;
		}
		text {
			margin-left: 30rpx;
			font-size: 28rpx;
			color: #555555;
		}
	}
	.arrow {
		@include bis('../../../static/icon/icon_enter.png');
		width: 18rpx;
		height: 30rpx;
	}
}
</style>
